package com.example.terminal.adapter;

import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.terminal.R;
import com.example.terminal.base.BaseRecyclerAdapter;
import com.example.terminal.base.BaseViewHolder;
import com.example.terminal.bean.StoreListDetailsBean;
import com.google.zxing.common.StringUtils;

import java.util.List;

public class StoreScanAdapter extends BaseRecyclerAdapter<StoreListDetailsBean.DataBean.TstoregeInDeviceBean.tstoregeInDeviceDetailListBean> {

    private String mImeiStatus;
    private String mStatus;

    public StoreScanAdapter(Context mContext, List<StoreListDetailsBean.DataBean.TstoregeInDeviceBean.tstoregeInDeviceDetailListBean> mList, String imeiStatus, String status) {
        super(mContext, mList);
        this.mImeiStatus = imeiStatus;
        this.mStatus = status;
    }

    @Override
    public int setContentView() {
        return R.layout.adapter_scan_store;
    }

    @Override
    protected void bindData(BaseViewHolder holder, StoreListDetailsBean.DataBean.TstoregeInDeviceBean.tstoregeInDeviceDetailListBean data, int position) {
        ImageView mIv_delete = holder.findViewById(R.id.mIv_delete);
        RelativeLayout mRl_delete = holder.findViewById(R.id.mRl_delete);
        TextView mTv_position = holder.findViewById(R.id.mTv_position);
        EditText mEt_scanPositionlist = holder.findViewById(R.id.mEt_scanPositionlist);
        Button mBtnAdd = holder.findViewById(R.id.mBtnAdd);
        LinearLayout mLlAdd = holder.findViewById(R.id.mLlAdd);

        mEt_scanPositionlist.setFocusable(false);
        mEt_scanPositionlist.setFocusableInTouchMode(false);

//        if (data == null) {
//            mBtnAdd.setVisibility(View.VISIBLE);
//            mLlAdd.setVisibility(View.GONE);
//            setOnItemClickListener(mBtnAdd, position);
//        } else {
//            mBtnAdd.setVisibility(View.GONE);
//            mLlAdd.setVisibility(View.VISIBLE);

        mTv_position.setText(position + 1 + "");


        mEt_scanPositionlist.setVisibility(View.VISIBLE);
        mEt_scanPositionlist.setText(data.getImei());

        setOnTextClickListener(mIv_delete, position);
//        setOnTextClickListener(mEt_positionlist, position);
//        }
    }
}
